package a.e;

import a.c.q;
import a.j.g;
import a.j.pg;

import java.io.*;
import java.net.URL;

public class p
  extends e
{
  private e c;
  private int d = 1;
  private int e = 1;
  private int f = 2147483647;
  private int g = 2147483647;
  private boolean h = false;
  private boolean i = false;
  public static boolean j;
  
  public p(e parame)
  {
    this.c = parame;
  }
  
  public String a()
  {
    return this.c.a();
  }
  
  public void a(boolean paramBoolean)
  {
    this.i = paramBoolean;
  }
  
  public boolean f()
  {
    return this.i;
  }
  
  public void a(int paramInt1, int paramInt2)
  {
    this.f = paramInt1;
    this.g = paramInt2;
    this.h = true;
  }
  
  public void a(int paramInt)
  {
    this.d = paramInt;
    this.h = false;
  }
  
  public void b(int paramInt)
  {
    this.e = paramInt;
    this.h = false;
  }
  
  public boolean c()
  {
    return false;
  }
  
  public boolean d()
  {
    return this.c.d();
  }
  
  public void a(g paramg, String paramString)
    throws IOException
  {
    int i13 = e.b;
    int i12 = e.a;
    URL localURL = paramg.cb();
    pg localpg = (pg)paramg.fb();
    if (i13 == 0) {
      if (localpg == null) {
        throw new IllegalArgumentException("graph has no associated Graph2DView");
      }
    }
    int k = localpg.R().x;
    int m = localpg.R().y;
    int n = localpg.getWidth();
    int i1 = localpg.getHeight();
    double d1 = localpg.M();
    int i2;
    int i3;
    if (i13 == 0)
    {
      if (!this.h)
      {
        this.f = ((int)Math.ceil(n / this.e));
        this.g = ((int)Math.ceil(i1 / this.d));
        i2 = this.f;
        i3 = this.g;
        if (i13 != 0) {
          break label259;
        }
        if (i12 != 0)
        {
          if (i13 == 0) {}
          q.n = !q.n;
        }
      }
      else
      {
        this.e = ((int)Math.ceil(n / this.f));
        this.d = ((int)Math.ceil(i1 / this.g));
      }
    }
    else
    {
      i2 = Math.min(this.f, (int)Math.ceil(n / this.e));
      i3 = Math.min(this.g, (int)Math.ceil(i1 / this.d));
    }
    localpg.setSize(i2, i3);
    label259:
    int i4 = this.c != null ? paramString.lastIndexOf(this.c.b()) - 1 : paramString.length();
    String str1 = paramString.substring(0, i4).replace(File.separatorChar, '/');
    int i5 = 0;
    int i6 = 0;
    int i7 = this.e - (this.e * i2 - n);
    int i8 = this.d - (this.d * i3 - i1);
    int i9 = i2;
    double d2 = k * d1;
    label404:
    do
    {
      if (i5 >= this.e) {
        break;
      }
      i6 = 0;
      if (i12 != 0) {
        break label586;
      }
      if (i7 == 0)
      {
        if (i13 != 0) {
          break label404;
        }
        if (i9 > 1) {
          localpg.setSize(--i9, i3);
        }
      }
      int i10 = i8;
      int i11 = i3;
      double d3 = m * d1;
      do
      {
        do
        {
          if (i6 >= this.d) {
            break label521;
          }
          if (i12 != 0) {
            break;
          }
          if ((i10 == 0) && (i11 > 1)) {
            localpg.setSize(i9, --i11);
          }
          localpg.b(d2 / d1, d3 / d1);
          String str2 = b(paramg, this.c, str1, i6, i5);
          a(paramg, this.c, str2, i6, i5);
          d3 += i11;
          i6++;
          i10--;
        } while (i12 == 0);
        localpg.setSize(i9, i3);
        d2 += i9;
        i5++;
        i7--;
      } while (i13 != 0);
    } while (i12 == 0);
    label521:
    localpg.setSize(n, i1);
    localpg.b(k, m);
    paramg.a(localURL);
    if ((i13 != 0) || (f())) {
      label586:
      a(this.d, this.e, str1, this.c.b());
    }
    if (i13 != 0) {
      q.o = !q.o;
    }
  }
  
  protected void a(g paramg, e parame, String paramString, int paramInt1, int paramInt2)
    throws IOException
  {
    if ((e.b != 0) || (parame != null)) {
      parame.a(paramg, paramString);
    }
  }
  
  protected String b(g paramg, e parame, String paramString, int paramInt1, int paramInt2)
  {
    if (parame != null) {
      return paramString + (1 + paramInt2) + '_' + (1 + paramInt1) + '.' + parame.b();
    }
    return paramString + (1 + paramInt2) + '_' + (1 + paramInt1);
  }
  
  private void a(int paramInt1, int paramInt2, String paramString1, String paramString2)
    throws IOException
  {
    int i1 = e.b;
    int n = e.a;
    PrintWriter localPrintWriter = new PrintWriter(new FileWriter(paramString1 + ".html"));
    paramString1 = paramString1.substring(paramString1.lastIndexOf('/') + 1);
    localPrintWriter.println("<html>");
    localPrintWriter.println("  <head></head>");
    localPrintWriter.println("  <body>");
    localPrintWriter.println("    <table cellspacing=0 cellpadding=0 border=0>");
    int k = 0;
    if (k < paramInt1) {
      localPrintWriter.println("      <tr>");
    }
    do
    {
      localPrintWriter.print("    ");
      if ((i1 == 0) && (n != 0)) {
        return;
      }
      int m = 0;
      if (m < paramInt2)
      {
        localPrintWriter.println("        <td><img src=\"" + paramString1 + (1 + m) + '_' + (1 + k) + '.' + paramString2 + "\"></td>");
        m++;
      }
      for (;;)
      {
        if (i1 == 0) {
          if (n == 0)
          {
            if (n == 0) {
              break;
            }
            localPrintWriter.println("      </tr>");
            if (i1 != 0) {
              continue;
            }
            k++;
          }
        }
      }
      if (n == 0) {
        break;
      }
      localPrintWriter.println("    </table>");
      localPrintWriter.println("  </body>");
      localPrintWriter.println("</html>");
    } while (i1 != 0);
    localPrintWriter.close();
  }
  
  public String b()
  {
    return this.c.b();
  }
  
  public void a(g paramg, InputStream paramInputStream)
    throws IOException
  {
    this.c.a(paramg, paramInputStream);
  }
  
  public void a(g paramg, OutputStream paramOutputStream)
    throws IOException
  {
    this.c.a(paramg, paramOutputStream);
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.e.p

 * JD-Core Version:    0.7.0.1

 */